home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 December / 2004-12 CHIP.iso / CHIP / Porady / Srodowisko PHP-MySQL / WAMP5 1.3 / wamp5_1.3.exe / {app} / www / sqlitemanager / main.php < prev    next >
PHP Script  |  2004-09-24  |  5KB  |  136 lines

  1. <?php
  2. /**
  3. * Web based SQLite management
  4. * @package SQLiteManager
  5. * @author FrΘdΘric HENNINOT
  6. * @version $Id: main.php,v 1.22 2004/09/17 09:03:08 freddy78 Exp $ $Revision: 1.22 $
  7. */
  8.  
  9. session_start();
  10. ob_start();
  11. include_once "./include/defined.inc.php";
  12. include_once INCLUDE_LIB."config.inc.php";
  13.  
  14.  
  15. if(empty($dbsel) && ( !isset($GLOBALS["action"]) || ($GLOBALS["action"]!="auth") || (($GLOBALS["action"]=="auth") && !$SQLiteManagerAuth->isAdmin()) )){
  16. displayHeader("main");
  17.  
  18. ?>
  19. <h2><?php echo $traduct->get(2)." ".SQLiteManagerVersion ?></h2>
  20.     <h4><?php echo $traduct->get(3)." ".$SQLiteVersion ?> / <?php echo $traduct->get(150)." ".phpversion() ?></h4>
  21.     <?php if(READ_ONLY) echo "<table width=80% align='center'><tr><td style='font-size: 10px; border: 1px solid red; color: red; align: center'>".$traduct->get(154)."</td></tr></table>"; ?>
  22.  
  23.     <table align="center" width=90% cellspacing=5 cellpadding=5>
  24.         <tr>
  25.             <td width=50% align="center" class="boxtitle">SQLite
  26.             </td>
  27.             <td width=50% align="center" class="boxtitle">SQLiteManager
  28.             </td>
  29.         </tr>
  30.         <tr>
  31.             <td nowrap="nowrap"><?php include INCLUDE_LIB."add_database.php"; ?></td>
  32.             
  33.             <td align="left" nowrap="nowrap"><form action="" method="POST"> <?php echo $traduct->get(141); ?> : 
  34.                 <select name="Langue" onChange="submit()"><?php echo getAvailableLanguage(); ?></select><br><br>
  35.                  <?php echo $traduct->get(142); ?> : 
  36.                 <select name="Theme" onChange="submit()"><?php echo getAvailableTheme(); ?></select></form><br>
  37.                  » <a href="http://www.sqlite.org/" target="docs" class="Browse"><?php echo $traduct->get(4); ?></a>
  38.                 <br> » <a href="http://www.sqlite.org/lang.html" target="docs" class="Browse"><?php echo $traduct->get(5); ?></a>
  39.             </td>
  40.         </tr>
  41.         <tr>
  42.             <td colspan=2>    
  43.                 <?php if(WITH_AUTH){ ?> <hr style="border: 1px dashed blue"> <?php } ?>
  44.                 <div >
  45.                 <?php if(!READ_ONLY && WITH_AUTH && $SQLiteManagerAuth->isAdmin()) { ?>
  46.                 » <a href="?action=auth" class="Browse"><?php echo $traduct->get(156); ?></a>
  47.                 <?php } ?>
  48.                 <?php if(!READ_ONLY && WITH_AUTH && ALLOW_CHANGE_PASSWD) {
  49.                     if($GLOBALS["action"] != "passwd") { ?>
  50.                 <br>» <a href="main.php?action=passwd" class="Browse"><?php echo $traduct->get(157); ?></a><br><br>
  51.                     <?php } else {
  52.                     // manage passwd
  53.                     echo "<blockquote>";
  54.                     $SQLiteManagerAuth->changePasswd();
  55.                     echo "</blockquote>";
  56.                     } }
  57.                     if(WITH_AUTH){
  58.                     ?>
  59.                 » <a href="index.php?action=logout" target="_parent" class="Browse"><?php echo $traduct->get(158); ?></a>
  60.                     <?php } ?>
  61.                 </div>
  62.             </td>
  63.         </tr>
  64.     </table>
  65. <?php
  66. } elseif(!isset($GLOBALS["action"]) || ($GLOBALS["action"]!="auth")) {
  67.     // gestion de la base selectionnΘ
  68.     include_once INCLUDE_LIB."SQLiteDbConnect.class.php";
  69.     $workDb = &new SQLiteDbConnect($tabInfoDb["location"]);
  70.     $workDb->includeUDF();
  71.     displayHeader("main");
  72.     displayMenuTitle();    
  73.     
  74.     switch($action){
  75.         case "":
  76.         case "properties":
  77.         default:
  78.             if($table || $TableName) $fileProp = "tableproperties";
  79.             elseif($view || $ViewName) $fileProp = "viewproperties";
  80.             elseif($trigger || $TriggerName) $fileProp = "triggerproperties";
  81.             elseif($function) $fileProp = "functproperties";
  82.             else $fileProp = "dbproperties";
  83.             include_once INCLUDE_LIB.$fileProp.".php";
  84.             break;
  85.         case "browseItem":
  86.             include INCLUDE_LIB."browse.php";
  87.             break;
  88.         case "sql":
  89.             include INCLUDE_LIB."sql.php";
  90.             break;
  91.         case "export":
  92.             include_once INCLUDE_LIB."SQLiteExport.class.php";
  93.             $export =& new SQLiteExport($workDb);            
  94.             break;
  95.         case "del":
  96.             $query = "DELETE FROM database WHERE id=".$dbsel.";";
  97.             if($dbsel) {
  98.                 SQLiteExecFunction($db, $query);
  99.                 // Remove attached databases
  100.                 SQLiteExecFunction($db, "DELETE FROM attachment WHERE base_id=".$dbsel." OR attach_id=".$dbsel);                
  101.             }                
  102.             $redirect = "<script>parent.location='index.php';</script>";
  103.             break;
  104.         case "add_view":
  105.             $action = "add";
  106.             include_once INCLUDE_LIB."viewproperties.php";
  107.             break;
  108.         case "add_trigger":
  109.             $action = "add";
  110.             include_once INCLUDE_LIB."triggerproperties.php";
  111.             break;
  112.         case "add_function":
  113.             $action = "add";
  114.             include_once INCLUDE_LIB."functproperties.php";
  115.             break;
  116.         case "options":
  117.             include_once INCLUDE_LIB."SQLiteDbOption.class.php";
  118.             $Option =& new SQLiteDbOption($workDb);
  119.             break;
  120.     }
  121. } elseif(isset($GLOBALS["action"]) && ($GLOBALS["action"]=="auth")){
  122.     displayHeader("main");
  123.     $SQLiteManagerAuth->manageAuth();
  124. }
  125. if(isset($workDb) && $workDb->connId && ($workDb->baseName!=":memory:")) {
  126.     $workDb->close();
  127.     @sqlite_close($db);
  128. }
  129.  
  130. if(isset($redirect) && !empty($redirect)){
  131.         ob_end_clean();
  132.         echo $redirect;
  133. }
  134. ob_end_flush();
  135. ?>
  136.